//展示抄经的功德
var meritsLayer = null;
function showMerits() {
	$(".merits-wrapper").show();

	meritsLayer = layer
			.open({
				type : 1,
				title : [
						"抄经的功德",
						'background-color:rgba(110, 82, 1, 0.5);text-align:center;font-weight: 500;color:rgba(255,255,255,1);' ],
				closeBtn : 0,
				shadeClose : true,
				skin : 'layer-ext-moon',
				content : $('.merits-wrapper'),
				area : [ '900px', 'auto' ],
				shift : 4,
				scrollbar : false
			});
}

// 展示抄经注意事项
var attentionLayer = null;
function showAttention() {
	$(".attention-wrapper").show();
	attentionLayer = layer
			.open({
				type : 1,
				title : [
						"抄经注意事项|抄写佛经应该注意什么",
						'background-color:rgba(110, 82, 1, 0.5);text-align:center;font-weight: 500;color:rgba(255,255,255,1);' ],
				closeBtn : 0,
				shadeClose : true,
				skin : 'layer-ext-moon',
				content : $('.attention-wrapper'),
				area : [ '800px', 'auto' ],
				shift : 4,
				scrollbar : false
			});
}

/**
 * 获取列表
 * 
 * @param cat
 * @param sort
 * @param inx
 */
function getBookList(inx) {
	$.ajax({
		// async : false,
		type : "POST",
		url : baseUrl + "/write/list-part.html?page=" + inx + "&bKeywords="
				+ $('#bookKeywordsInput').val(),
		success : function(html) {
			$('#-BOOK-MAIN-CONTENT-').empty().append(html);
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			var msg = XMLHttpRequest.statusText;
			var options = {
				type : SELF_ALERT_TYPES.danger,
				msg : msg,
				hasClose : true,
				time : 3000
			};
			selfAlert(options);
		}
	});
}

$(function() {
	$('#bookKeywordsBtn').click(function() {
		searchBook();
	});

	$('#bookKeywordsInput').bind('keydown', function(e) {
		var key = e.which;
		if (key == 13) {
			searchBook();
		}
	});
});

function searchBook() {
	var keywords = $.trim($('#bookKeywordsInput').val());
	if (!keywords) {
		return;
	}
	window.location.href = baseUrl + "/write/list.html?bKeywords="
			+ $('#bookKeywordsInput').val();
}
